/*
 * Copyright (C) 2016 yixun All Rights Reserved.
 * 
 * TelRecordDto.java
 */
package com.emm.yixun.common.model.dto;

import com.emm.yixun.common.model.TelRecord;

import java.util.LinkedList;
import java.util.List;
import java.util.Date;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

/**
 * [文件名称]<br>
 * TelRecordDto.java<br>
 * <br>
 * [文件描述]<br>
 * 通话记录 数据辅助类<br>
 * <br>
 * [修改记录]<br>
 * 2016-11-01 11:11:43 创建 陶俊代码生成器<br>
 * 
 * @author 陶俊代码生成器
 * @version 1.00
 */
public class TelRecordDto extends TelRecord {
	private static final long serialVersionUID = 1L;
	/**
	 *需要正序字段名
	 */
	private List<String> asc;
	/**
	 *需要逆序字段名
	 */
	private List<String> desc;
	/**
	 *排序SQL
	 */
	private String orders;
	/**
	 *数据权限过滤条件
	 */
	private String dataPermission;
	
	//用户名称
	private String userName;
	//客户名称
	private String customerName;
	//部门名称
	private String departmentName;
	//部门ID
	private Long userDepartmentId;
	
	private Long startBillableSeconds;
	private Long endBillableSeconds;
    
    /**
	 *  添加需要正序字段名
	 */
	public void addAsc(String col){
		if(asc==null){
			asc = new LinkedList<String>();
		}
		asc.add(col);
	}
	
	/**
	 *  清空需要正序字段名
	 */
	public void cleanAsc(){
		asc = null;
	}
	
	/**
	 *  添加需要逆序字段名
	 */
	public void addDesc(String col){
		if(desc==null){
			desc = new LinkedList<String>();
		}
		desc.add(col);
	}
	
	/**
	 *  清空需要逆序字段名
	 */
	public void cleanDesc(){
		desc = null;
	}
	
	/**
	 *  如果排序SQL为空根据需要正逆序的字段名拼接排序SQL
	 */
	public String  getOrders() {
		StringBuilder orderStr = null;
		StringBuilder ascStr;
		StringBuilder descStr;
		if(orders==null){
			if(asc!=null){
				ascStr = new StringBuilder();
				orderStr = new StringBuilder();
				String pex = "";
				for(String a : asc){
					ascStr.append(pex+a);
					pex = ",";
				}
				orderStr.append(ascStr.toString()+" ASC");
			}
			if(desc!=null){
				descStr = new StringBuilder();
				String pex = "";
				for(String d : desc){
					descStr.append(pex+d);
					pex = ",";
				}
				if(orderStr==null){
					orderStr = new StringBuilder();
					orderStr.append(descStr.toString()+" DESC");
				}else{
					orderStr.append(","+descStr.toString()+" DESC");
				}
			}
			orders = orderStr!=null?orderStr.toString():null;
		}
		
		return orders;
	}
	
	public String getDataPermission() {
		return dataPermission;
	}

	public void setDataPermission(String dataPermission) {
		this.dataPermission = dataPermission;
	}
	
	/**
	 *  设置排序SQL
	 */
	public void setOrders(String orders) {
		this.orders = orders;
	}
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
	private Date callTimeBefore;
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date callTimeAfter;
	private Date updateTimeBefore;
	private Date updateTimeAfter;
	private Date endTimeBefore;
	private Date endTimeAfter;
	private Date createTimeBefore;
	private Date createTimeAfter;
	private Date startTimeBefore;
	private Date startTimeAfter;
	private Date answerTimeBefore;
	private Date answerTimeAfter;
	private Date bridgeTimeBefore;
	private Date bridgeTimeAfter;

    public Date getCallTimeBefore() {
        return this.callTimeBefore;
    }
    public void setCallTimeBefore(Date callTimeBefore) {
        this.callTimeBefore = callTimeBefore;
    }

    public Date getCallTimeAfter() {
        return this.callTimeAfter;
    }
    public void setCallTimeAfter(Date callTimeAfter) {
        this.callTimeAfter = callTimeAfter;
    }
    public Date getUpdateTimeBefore() {
        return this.updateTimeBefore;
    }
    public void setUpdateTimeBefore(Date updateTimeBefore) {
        this.updateTimeBefore = updateTimeBefore;
    }

    public Date getUpdateTimeAfter() {
        return this.updateTimeAfter;
    }
    public void setUpdateTimeAfter(Date updateTimeAfter) {
        this.updateTimeAfter = updateTimeAfter;
    }
    public Date getEndTimeBefore() {
        return this.endTimeBefore;
    }
    public void setEndTimeBefore(Date endTimeBefore) {
        this.endTimeBefore = endTimeBefore;
    }

    public Date getEndTimeAfter() {
        return this.endTimeAfter;
    }
    public void setEndTimeAfter(Date endTimeAfter) {
        this.endTimeAfter = endTimeAfter;
    }
    public Date getCreateTimeBefore() {
        return this.createTimeBefore;
    }
    public void setCreateTimeBefore(Date createTimeBefore) {
        this.createTimeBefore = createTimeBefore;
    }

    public Date getCreateTimeAfter() {
        return this.createTimeAfter;
    }
    public void setCreateTimeAfter(Date createTimeAfter) {
        this.createTimeAfter = createTimeAfter;
    }
    public Date getStartTimeBefore() {
        return this.startTimeBefore;
    }
    public void setStartTimeBefore(Date startTimeBefore) {
        this.startTimeBefore = startTimeBefore;
    }

    public Date getStartTimeAfter() {
        return this.startTimeAfter;
    }
    public void setStartTimeAfter(Date startTimeAfter) {
        this.startTimeAfter = startTimeAfter;
    }
    public Date getAnswerTimeBefore() {
        return this.answerTimeBefore;
    }
    public void setAnswerTimeBefore(Date answerTimeBefore) {
        this.answerTimeBefore = answerTimeBefore;
    }

    public Date getAnswerTimeAfter() {
        return this.answerTimeAfter;
    }
    public void setAnswerTimeAfter(Date answerTimeAfter) {
        this.answerTimeAfter = answerTimeAfter;
    }
    public Date getBridgeTimeBefore() {
        return this.bridgeTimeBefore;
    }
    public void setBridgeTimeBefore(Date bridgeTimeBefore) {
        this.bridgeTimeBefore = bridgeTimeBefore;
    }

    public Date getBridgeTimeAfter() {
        return this.bridgeTimeAfter;
    }
    public void setBridgeTimeAfter(Date bridgeTimeAfter) {
        this.bridgeTimeAfter = bridgeTimeAfter;
    }

	public List<String> getAsc() {
		return asc;
	}

	public void setAsc(List<String> asc) {
		this.asc = asc;
	}

	public List<String> getDesc() {
		return desc;
	}

	public void setDesc(List<String> desc) {
		this.desc = desc;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getCustomerName() {
		return customerName;
	}

	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	public String getDepartmentName() {
		return departmentName;
	}

	public void setDepartmentName(String departmentName) {
		this.departmentName = departmentName;
	}

	public Long getUserDepartmentId() {
		return userDepartmentId;
	}

	public void setUserDepartmentId(Long userDepartmentId) {
		this.userDepartmentId = userDepartmentId;
	}

	public Long getStartBillableSeconds() {
		return startBillableSeconds;
	}

	public void setStartBillableSeconds(Long startBillableSeconds) {
		this.startBillableSeconds = startBillableSeconds;
	}

	public Long getEndBillableSeconds() {
		return endBillableSeconds;
	}

	public void setEndBillableSeconds(Long endBillableSeconds) {
		this.endBillableSeconds = endBillableSeconds;
	}
    
    
	
}
